<!--学籍信息维护-->
<template>
  <div class="wrapper-container">
    <div class="table-container table-css">
      <el-table :data="tableData" border style="width: 100%" class="table-data" :header-cell-style="{background:'#edf2f9','border-color': '#c7d7eb'}"  @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center"></el-table-column>
        <el-table-column prop="studentCode" label="学号" align="center"></el-table-column>
        <el-table-column prop="studentName" label="姓名" align="center" width="220">
            <template slot-scope="scope">
                <span class="editName">
                    {{scope.row.studentName}}<img @click="jumpBasic(scope.row.studentCode)" src="../../../assets/assessment/icon-plan-record-detail.png">
                </span>
            </template>
        </el-table-column>
        <el-table-column prop="yearSpecialtyName" label="专业班次" align="center"> </el-table-column>
        <el-table-column prop="gender" label="性别" align="center"> </el-table-column>
        <el-table-column prop="birthday" label="出生日期" align="center"></el-table-column>
        <el-table-column prop="yearSpecialtyName" label="专业" align="center" width="220"></el-table-column>
      </el-table>
    </div>
    <div class="button-group">
        <div class="" @click="passInfo(true)">批量通过并提交</div>
        <div class="" @click="cancelInfo(false)">批量不通过</div>
    </div>
    <div class="pagination-block">
      <el-pagination prev-text="上一页" next-text="下一页" v-if="total>50" :page-size="50" @current-change="currentPage"
      layout="prev, pager, next, jumper" :total="total"></el-pagination>
    </div>
  </div>
</template>

<script>
import {studentStatusAudit,studentStatusInfo} from "@/api/student";

export default {
  data() {
    return {
      total:1,
      pageNo:1,
      tableData: [],
      IDS:[]
    };
  },
  mounted(){
    this.initList()
  },
  methods: {
    handleSelectionChange(e){
      this.IDS = e.map(item=>item.studentCode);
    },
    //初始表格
    async initList(){
      let res = await studentStatusInfo({pageNo:this.pageNo})
      if(res.code == 200){
        this.tableData = res.data.recodes
      }
    },
    //当前页
    currentPage(e){
      this.pageNo = e;
      this.initList()
    },
    //批量通过
    async passInfo(isPass){
      //0:待审核，1.通过(免审核),2.未提交,3.下发核对=打回=不通过=3
      let params = {
        dataIdList:this.IDS,
        state:isPass?1:3
      }
      if(this.IDS.length>0){
        let res =  await studentStatusAudit(params)
        if(res.code == 200){
          let mes = isPass?'通过成功！':'不通过成功！'
          this.$message(mes);
          this.initList()
        }
      }else{
        this.$message({
          message: '请选择要审核的数据！',
          type: 'warning'
        });
      }
    },
    jumpBasic(code){
      //跳转到学员-个人信息-查询
      this.$router.push({
        path:'/student/studentStatus/infoSearch',
        query:{
            studentCode:code
        }
      })
    },
  },
};
</script>
<style lang="less" scoped>
.table-css {
  margin-top: 30px;
  /deep/.el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

 /deep/ .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  /deep/.el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }
}
</style>

<style lang="less" scoped>
@import "../../../styles/commonCss.less";
</style>
